
#include <iostream>

#include <cppunit/extensions/HelperMacros.h>

#include "../../tuxitty/src/SessionManager.h"

class SessionManagerTest : public CppUnit::TestFixture
{
	CPPUNIT_TEST_SUITE( SessionManagerTest );

	CPPUNIT_TEST( TestOpenSession );	
	CPPUNIT_TEST( TestCloseSession );

	CPPUNIT_TEST_SUITE_END();

public:
	SessionManager* manager;

	void setUp(){
		manager = new SessionManager(NULL);
	}

	void tearDown(){
		delete manager;
	}

	void TestOpenSession()
	{	
		manager->OpenSession(_T("test"));
		CPPUNIT_ASSERT(1 == manager->GetSessionList().size());

		manager->OpenSession(_T("test"));
		CPPUNIT_ASSERT(1 == manager->GetSessionList().size());
	}

	void TestCloseSession()
	{	
		MsnSession* session = manager->OpenSession(_T("test"));
		manager->CloseSession(session);
		CPPUNIT_ASSERT(0 == manager->GetSessionList().size());
	}

};


CPPUNIT_TEST_SUITE_REGISTRATION(SessionManagerTest);
